using System.Collections.Generic;
using MoonFramework.Template;
using UnityEngine;

namespace MoonFramework.Scripts.Tool.System.Setting
{
    public class ConfigManager : BaseMonoManager<ConfigManager>
    {
        [SerializeField] private ConfigSetting configSetting;

        public Dictionary<string, BaseConfig> GetConfigs(string configTypeName)
        {
            return configSetting.GetConfigs(configTypeName);
        }

        /// <summary>
        ///     获取配置
        /// </summary>
        /// <typeparam name="T">具体的配置类型</typeparam>
        /// <param name="configTypeName">配置类                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            型名称</param>
        /// <param name="id">id</param>
        public T GetConfig<T>(string configTypeName, string id) where T : BaseConfig
        {
            return configSetting.GetConfig<T>(configTypeName, id);
        }
        
        public T GetConfig<T>(string configTypeName, int id) where T : BaseConfig
        {
            return configSetting.GetConfig<T>(configTypeName, id.ToString());
        }
    }
}